package com.info.zhiduoduo.weixin.formbean.partner;

import com.info.zhiduoduo.common.validator.Phone;
import com.info.zhiduoduo.repository.entity.marketingcooperative.MarketingCooperativeRecord;
import com.info.zhiduoduo.repository.entity.partner.PartnerVaccineRecord;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class PartnerVaccineRecordFormBean {

	/**
	 * 合伙人id
	 */
	@ApiModelProperty("合伙人id")
	@NotNull(message = "合伙人ID无效")
	private Integer partnerid;

	/**
	 * 企业id
	 */
	@ApiModelProperty("企业id")
	@NotNull(message = "企业ID无效")
	private Integer compid;

	/**
	 * 联系人姓名
	 */
	@ApiModelProperty("联系人姓名")
	private String contactName;

	/**
	 * 联系人电话
	 */
	@ApiModelProperty("联系人电话")
	@Phone
	private String contactPhone;

	/**
	 * 抗原数量
	 */
	@ApiModelProperty("抗原数量")
	@Positive(message = "抗原数量无效")
	private Integer vaccineAmount;

	/**
	 * 抗原品牌
	 */
	@ApiModelProperty("抗原品牌")
	@NotEmpty(message = "抗原品牌无效")
	private String vaccineBrand;

	/**
	 * 备注
	 */
	@ApiModelProperty("备注")
	private String note;

	public PartnerVaccineRecord toEntity() {
		return new PartnerVaccineRecord().setPartnerid(partnerid)
				.setCompid(compid)
				.setContactName(contactName)
				.setContactPhone(contactPhone)
				.setVaccineAmount(vaccineAmount)
				.setVaccineBrand(vaccineBrand)
				.setNote(note);
	}

	public MarketingCooperativeRecord toMCEntity() {
		return new MarketingCooperativeRecord().setPartnerid(partnerid)
				.setCompid(compid);
//				.setContactName(contactName)
//				.setContactPhone(contactPhone)
//				.setCommodityAmount(vaccineAmount)
//				.setCommodityBrand(vaccineBrand)
//				.setNote(note);
	}
}
